UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q4uITd3Gj/o00QcCpkFRWZbJFHFk516Goy1fyseRFHg=' 
WHERE 
  key_id = 'c065f58be21ca22104a0d6d312d35af8541ae48ffdc2303dcb48140a9845ba40' 
  AND (
    token = 'Q4uITd3Gj/o00QcCpkFRWZbJFHFk516Goy1fyseRFHg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033