UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Bu7FDx1gXwdNOckttpxsIUdDKzQu4L84tA7Nq00q7os='
WHERE
key_id = '07c10405b128bb6c9484769da7e39c5a8f4fdfe9895d299237f9890cc9e68ce5'
AND (
token = 'Bu7FDx1gXwdNOckttpxsIUdDKzQu4L84tA7Nq00q7os='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)