UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lQTcQ1yMghZVsnkgSnM1RknXvdBLKUXwCLzSkZ7VAiY='
WHERE
key_id = 'a5065ffaf3a8897d16ad57f473435487eb05c220f8ca8683f8534b6359e53fe8'
AND (
token = 'lQTcQ1yMghZVsnkgSnM1RknXvdBLKUXwCLzSkZ7VAiY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)