UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WynO9g093QtGwWXP67pbEmqEjCEf7FvAiGn19/uJt/8=' 
WHERE 
  key_id = 'ce2e5b012db50b7606cf887afbbc8278fc3390719ff07ba909ffb4e6e725c8b1' 
  AND (
    token = 'WynO9g093QtGwWXP67pbEmqEjCEf7FvAiGn19/uJt/8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038