UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MJvf9kRj3hUTngHfV9wpagCuHlgcCxrQ1ud8yLRxIpM='
WHERE
key_id = '022309e12d5c9ede6685eb6676175a7d0a00e688243527a99233af8cb7d22a0c'
AND (
token = 'MJvf9kRj3hUTngHfV9wpagCuHlgcCxrQ1ud8yLRxIpM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)