UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IYpJuv6w8gAJ6yhLZTzrzlnOf5/peEbVwQerirfRYh8='
WHERE
key_id = '8f8a3524234a927197529150f414e38e63e652e0cb9d1a185cf88705338f6b58'
AND (
token = 'IYpJuv6w8gAJ6yhLZTzrzlnOf5/peEbVwQerirfRYh8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)