UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'agKIsEB4gZqOg2KDHGxJomEeL8I4F+E9NblGkB70blI='
WHERE
key_id = '06c7b9cf5b7b332ffb9642d2cce7c32898b93630d47fd0685f5cfa18627c868c'
AND (
token = 'agKIsEB4gZqOg2KDHGxJomEeL8I4F+E9NblGkB70blI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)