UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mWt9cXtrw5ILX4XOQCpmv08mZ59wzhmE1D10c1Vr0CE='
WHERE
key_id = '2a9b3369eec078c9ea96e71afa9c4b3fbc240f798f123362e8aea164b68a2ed2'
AND (
token = 'mWt9cXtrw5ILX4XOQCpmv08mZ59wzhmE1D10c1Vr0CE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)