UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hQr/j4p50pb2G0KzD7Ixd4dLhbm+xF562a1YtXfOx8w='
WHERE
key_id = '4d64002db86bd71acd8465191a88966e319224ee123bb3f052cefbed60fd556a'
AND (
token = 'hQr/j4p50pb2G0KzD7Ixd4dLhbm+xF562a1YtXfOx8w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)