UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rc9CJ9RKMgcdN0PSp6i1UE1VQZ1pesoFbKuwvUvWcVo=' 
WHERE 
  key_id = '159ac63c924b2a4f0b286f5e9bd6fae76a4b545c17c75381104631f48acf245e' 
  AND (
    token = 'Rc9CJ9RKMgcdN0PSp6i1UE1VQZ1pesoFbKuwvUvWcVo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024