UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j/Qx1lMj6JaqOvxhfLXONl7yDQcg7CJ1QaEtmKNYd4k=' 
WHERE 
  key_id = '3f781864908d31b8b2a9316e2f06520bdaa99957392a18d5f11ce8a82f44a6eb' 
  AND (
    token = 'j/Qx1lMj6JaqOvxhfLXONl7yDQcg7CJ1QaEtmKNYd4k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030