UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+mNIincNqybZLdLlnIp1DiN0pz0r5gwTaYnh+1k7InQ=' 
WHERE 
  key_id = '2f198b5151ebe3fdd688027c9b391148384a7f04ee4f455d56492114d34029d8' 
  AND (
    token = '+mNIincNqybZLdLlnIp1DiN0pz0r5gwTaYnh+1k7InQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032