UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oer9vP6Kj8AcNZGQGgTjOMQu5TBl6Aulx4T+C2boo4k='
WHERE
key_id = 'aec4267288403753fd893db07a12975474345e3de5fe1adeef4ca08dde96dd1d'
AND (
token = 'oer9vP6Kj8AcNZGQGgTjOMQu5TBl6Aulx4T+C2boo4k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)