UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '50S05ZzubtiZOxb+JMn4PPGZcICFHVbtFXTfmBB8JgA='
WHERE
key_id = 'b9c7c21ffae03070022da437ad09e916ad61bfdd3d4fc7678e5519fd04c974ac'
AND (
token = '50S05ZzubtiZOxb+JMn4PPGZcICFHVbtFXTfmBB8JgA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)