UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B6wVmImxjPOEkxs7hd33D13nP2hjPrbNUw02TgRu8t8=' 
WHERE 
  key_id = '8b96f273b61b81371f7ccd66eb10c33f778322ed0fdab96c386992f35523e6a3' 
  AND (
    token = 'B6wVmImxjPOEkxs7hd33D13nP2hjPrbNUw02TgRu8t8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040