UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h+LRZqMmuD3rh2X8BRkBMOzfkZDs0EUj0dd3MLV6Ekc=' 
WHERE 
  key_id = '4ee46a9015427efd2eaf81e47906589e41cf35acc81e3c23f8457b95cb12809d' 
  AND (
    token = 'h+LRZqMmuD3rh2X8BRkBMOzfkZDs0EUj0dd3MLV6Ekc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021