UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UqzY8zZhUhGEkbqPlcsdWi6eMkZ/6Xs7EF/q3GxrdCA='
WHERE
key_id = 'd75df47352d936914cb97bd42206a0e31fb5119fce5d03c28319f4a41a29f669'
AND (
token = 'UqzY8zZhUhGEkbqPlcsdWi6eMkZ/6Xs7EF/q3GxrdCA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)