UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5zygGCXSa2x1jocDbUsgX7KzogPBjoGjA8M2S3K9F9I='
WHERE
key_id = 'f8ad045e48593bc48217d682e6a61f3a96dadbdadd9c265f04bd277e84eb0ec0'
AND (
token = '5zygGCXSa2x1jocDbUsgX7KzogPBjoGjA8M2S3K9F9I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)