UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'el42XMuwr2fuWCOlXodkF0g7//1CBbK/8o/3W3JdTWM='
WHERE
key_id = 'ba2cd7dfc4ddaa3f1f6e5db47384ec5b1871599e0cbc8e0dbbf4241eb4f7ae7f'
AND (
token = 'el42XMuwr2fuWCOlXodkF0g7//1CBbK/8o/3W3JdTWM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)