UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gKba76ggvIS7rhRp6hXUPtns36CgZ9DWarxGnsVnXW8=' 
WHERE 
  key_id = '3ec8eaf22c9363a7a4300f390c64cc3e858324bd87897a2a0df6a2351865ca7b' 
  AND (
    token = 'gKba76ggvIS7rhRp6hXUPtns36CgZ9DWarxGnsVnXW8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036