UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YjL9VpCroab6O48IMcdV4Gf9NEpCuF4wcyiwggDw2Yg='
WHERE
key_id = 'efc380c69005a350b558805a57d3d4811f2e37574a9d308485d6c48fce1f97a0'
AND (
token = 'YjL9VpCroab6O48IMcdV4Gf9NEpCuF4wcyiwggDw2Yg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)