UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ofbgwb77P/f6x8tXg9Mf7U4Oa8p4bz6X1E5dnJ2wQ/g='
WHERE
key_id = '790af395ee675116b99c9909f51d96ae17fdef1b46f2564bf436dc4c4a4b07e9'
AND (
token = 'Ofbgwb77P/f6x8tXg9Mf7U4Oa8p4bz6X1E5dnJ2wQ/g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)