UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ktceEl7lV2N0ft23bAfC6lbikQEwmYf9g32noIhqhx8=' 
WHERE 
  key_id = 'c0c092154257a44e04a7d076b0254f5f96dc64b9a6683616b755d9acb3857fb7' 
  AND (
    token = 'ktceEl7lV2N0ft23bAfC6lbikQEwmYf9g32noIhqhx8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030