UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bHdzq6saQK/ZYuHWkdull+IfUQ63SFv1F7ec+Ff2P8w=' 
WHERE 
  key_id = '62a59dc4792b6d0b67a7a7e2a4685404510c929c4573bca46afe8e6a0d18ce12' 
  AND (
    token = 'bHdzq6saQK/ZYuHWkdull+IfUQ63SFv1F7ec+Ff2P8w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030