UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uOtjFgAc0T+U0uD8ht3IytmL3E85D8mZridow/I5Hko=' 
WHERE 
  key_id = '43b492a5564938f56c79f7759aa2aaab094897197f801535fa37a6b5ce5bfbc2' 
  AND (
    token = 'uOtjFgAc0T+U0uD8ht3IytmL3E85D8mZridow/I5Hko=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058