UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IOMjvzYOxURDAUByYrwjpmqURBh6l6oz2d5MKK9syxM='
WHERE
key_id = 'bd4cf7f2559b4489d0e97f5e0e16237f924d123f18d38eab1c7128f60896fa06'
AND (
token = 'IOMjvzYOxURDAUByYrwjpmqURBh6l6oz2d5MKK9syxM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)