UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wZSJEr+FuvTGvhM/zrSc6CV+bUM9xC+FhFc1Dgfwotk=' 
WHERE 
  key_id = '8006aaad848502dab0d068249a32a63857a43495cf314f25cf0cbc76bae505d0' 
  AND (
    token = 'wZSJEr+FuvTGvhM/zrSc6CV+bUM9xC+FhFc1Dgfwotk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017