UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't+hpfOLsAJlB9OMcbk84efSUeeX2koM/F1YF2+vKZ6M=' 
WHERE 
  key_id = '59b751e81fc1e1ea3639897069ee43e7cce551ef9ce2327e50312c794e20b948' 
  AND (
    token = 't+hpfOLsAJlB9OMcbk84efSUeeX2koM/F1YF2+vKZ6M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026