UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AoGOYvyBSL+QPU1JnXy3iIQddDQOkBuuRsp4Tv1GPCs='
WHERE
key_id = 'eafd1d9545d3525f89894e1ff13b1f9cc9639da90690c9bdb676fefc43f67aa3'
AND (
token = 'AoGOYvyBSL+QPU1JnXy3iIQddDQOkBuuRsp4Tv1GPCs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)