UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ippE8uXLp9Bw51Z5h8CX7m94NA82m0m9yYTl9DwdIxU='
WHERE
key_id = '95c1883005d82fcd47d2baad9e84e653010ab04947905a8aef3d29573718f2cd'
AND (
token = 'ippE8uXLp9Bw51Z5h8CX7m94NA82m0m9yYTl9DwdIxU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)