UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8xERRxDoYGiJZ20IbUO/JrXiljbOpEuoF7Rr+HlVRbw=' 
WHERE 
  key_id = '097a9cee18853666b517a3f76cccefa73b3ce80053236c0de7df0425302582a0' 
  AND (
    token = '8xERRxDoYGiJZ20IbUO/JrXiljbOpEuoF7Rr+HlVRbw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049