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