UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NNmQvjvQ+cXKntGFr3bhV2ye496N3euvcHJBUTTTN4E='
WHERE
key_id = '8182467e3f83d2b62416dc35e141fa491e502f519ed8e0ee49c4776cc44687c7'
AND (
token = 'NNmQvjvQ+cXKntGFr3bhV2ye496N3euvcHJBUTTTN4E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)