UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E9KmAH3KlCxQVdgDEr1oHA/dK6O8uK1JmczvRw+JBGs='
WHERE
key_id = '87867096b76bcd1030c7059119815425c3bca800ea41db6c48224855f77c6a8c'
AND (
token = 'E9KmAH3KlCxQVdgDEr1oHA/dK6O8uK1JmczvRw+JBGs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)