UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nMos8GA/xgjA23UMRYQLUSy1F2+2m5JhBPBOUkG0gfE='
WHERE
key_id = 'bc9f1fe3dbe803865335f9786e106cb5ccd42c11b5e772f495756a6c91a9c668'
AND (
token = 'nMos8GA/xgjA23UMRYQLUSy1F2+2m5JhBPBOUkG0gfE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)